home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 May / macformat-024.iso / Demos / DTP / HomePublisher Demo / AHP Pouch / AutoCreate / Newsletters / _CNCreateJumpLines / _CNCreateJumpLines
Encoding:
Text File  |  1993-09-17  |  4.6 KB  |  161 lines  |  [SGPA/SCPG]

  1. on createJumpLines
  2. put 0 into n -- Count for Jump-Line stories.
  3.  
  4. -- Find all the Stories & set thier fonts to THE_FONT
  5. -- Item 1 of name tells if it is a story. (Word 2 = Story Number)
  6. -- Item 2 of name tells what link order. (Word 2 = If it a title (Headline) ).
  7. -- item 3 of name tells what page it is on.
  8. set lockscreen to true
  9.  
  10. put "unknown" into TheStories
  11. put 0 into TotalStories
  12.  
  13. put "Times" into THE_FONT
  14. put 12 into THE_SIZE
  15. -- Find all unique stories.
  16. repeat with x = 1 to number of pages
  17. set currentpage to x
  18. Repeat with x = 1 to the number of objects
  19. set the itemdel to "\"
  20. if (Word 1 of name of object x = "Story") and ¬
  21. (word 2 of item 2 of name of object x ≠ "title") then -- Found a story!
  22. set the itemdel ","
  23.  
  24. -- Check if we have this story already...
  25. put "No Match" into FindResult
  26. repeat with y = 1 to number of items in TheStories
  27. if name of object x = item y of TheStories then
  28. put "Match" into FindResult
  29. end if
  30. end repeat -- Found Match?
  31.  
  32. if FindResult = "No Match" then
  33. put TotalStories + 1 into TotalStories
  34. put the name of object x into item TotalStories of TheStories
  35. end if
  36. put empty into FindResult
  37.  
  38. end if
  39. end repeat -- Objects
  40. set the itemdel to ","
  41. end repeat -- Pages
  42. set the currentpage to 1 
  43.  
  44. -- Get the number of stories
  45. put 1 into NumberOfStories
  46. repeat with s = 1 to number of items in TheStories
  47. put item s of TheStories into TheCurrentStory
  48. set itemdel to "\"
  49. put word 2 of item 1 of TheCurrentStory into TheCount
  50. set itemdel to ","
  51. if theCount > NumberOfStories then put theCount into NumberOfStories
  52. end repeat
  53.  
  54. -- Go thru all the stories.
  55. repeat with t = 1 to NumberOfStories
  56.  
  57. --Collect the story chains together, in link order.
  58. put 0 into LinkCount
  59. put empty into theLinkStories
  60. repeat with c = 1 to Number Of items in TheStories
  61. put item c of TheStories into CurrentStory
  62. set itemdel to "\"
  63. put word 2 of item 1 of CurrentStory into TheCount
  64. set itemdel to ","
  65.  
  66. if theCount = t then 
  67. put linkCount+1 into LinkCount
  68. put CurrentStory into item LinkCount of TheLinkStories
  69. end if
  70. end repeat
  71.  
  72. -- Does this story contain more than 1 link that crosses page boundaries?
  73. if LinkCount > 1 then
  74.  
  75. -- Now go thru all the links, and find the breaks.
  76. put item 1 of theLinkStories into ThePrevStoryLinkObject
  77. repeat with s = 2 to LinkCount
  78. -- Get the page of the s'th story.
  79. put item s of theLinkStories into TheStoryLinkObject
  80. set itemdel to "\"
  81. put item 3 of thePrevStoryLinkObject into PrevStoryPage
  82. put item 3 of theStoryLinkObject into StoryPage
  83. set itemdel to ","
  84.  
  85.  
  86. if PrevStoryPage ≠ StoryPage then
  87. -- Create a jump-line objects.
  88. set currentpage to PrevStoryPage
  89. -- Get name of this story.
  90. put username of story (item 1 of storyloc of object thePrevStoryLinkObject)¬
  91. into theStoryName
  92.  
  93. put the rect of object thePrevStoryLinkObject into RectOfPrevObj
  94.  
  95. -- Create "Continued on Page" object.
  96. put n+1 into n
  97. put "Jump Line From Obj " & n into TheJumpObj
  98. open story TheJumpObj
  99. -- Calc rect of prev object.
  100.  
  101. put item 1 of RectOfPrevObj into pLeft
  102. put item 2 of RectOfPrevObj into pTop
  103. put item 3 of RectOfPrevObj into pRight
  104. put item 4 of RectOfPrevObj into pBottom
  105. --put pLeft + ((pRight - pLeft)/2) into pLeft -- Draw from center.
  106. put pBottom - .36 into pTop -- Draw from bottom.
  107.  
  108. draw rectangle from pLeft,pTop to pRight,pBottom
  109. -- Set text offsets
  110. close story
  111. -- Enter text into obj.
  112. put quote & theStoryName & quote & " continued on page " & StoryPage into ¬
  113. story TheJumpObj
  114. set textwrap of last object to 0 aRoundRect
  115. set linePattern of last object to 0
  116. select all text in story theJumpObj
  117. set RulerJustification to right
  118. set textface to italic
  119. set textsize to 8
  120.  
  121. -- Create "Cont'd From Page" object.
  122. set currentpage to StoryPage
  123. put the rect of object theStoryLinkObject into RectOfObj
  124. put "Jump Line To Obj " & n into TheJumpObj
  125. open story TheJumpObj
  126. -- Calc rect of prev object.
  127. put item 1 of RectOfObj into pLeft
  128. put item 2 of RectOfObj into pTop
  129. put item 3 of RectOfObj into pRight
  130. put item 4 of RectOfObj into pBottom
  131.  
  132. --put pRight - ((pRight - pLeft)/2) into pRight
  133. put pTop + .36 into pBottom
  134.  
  135. draw rectangle from  pLeft,pTop to pRight,pBottom
  136. -- set text offsets
  137. close story
  138. put quote & theStoryName & quote & " continued from page " & PrevStoryPage into¬
  139. story TheJumpObj
  140. --select all text of story TheJumpObj
  141. --set textstyle to italic -- x here
  142. set textWrap of last object to 0 aRoundRect
  143. set linePattern of last object to 0
  144. select all text in story theJumpObj
  145. set RulerJustification to left
  146. set textface to italic
  147. set textsize to 8
  148.  
  149. end if -- PrevPage ≠ StoryPage?
  150.  
  151. put TheStoryLinkObject into ThePrevStoryLinkObject
  152.  
  153. end repeat -- 2 to TotalStories.
  154. end if -- Totalstories > 1?
  155.  
  156. set currentpage to 1
  157. end repeat
  158.  
  159.  
  160. end createJumpLines
  161.      p\<BÏ